package de.uni.muenster.idw2.view;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.ImageView;

public class RotatorImage extends ImageView{

	private float angle = 0;
	private final Context context;;

	public RotatorImage(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		this.context = context;
	}

	public RotatorImage(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.context = context;
	}

	public RotatorImage(Context context) {
		super(context);
		this.context = context;
	}
	
	@Override
	protected void onDraw(Canvas canvas) {
		canvas.rotate(angle, getWidth()/2, getHeight()/2);
		
		super.onDraw(canvas);
	}
	
	public void rotate(int angle){
		this.angle = angle;
		invalidate();
	}

}
